<html>
<!-- =====================================================================

  File:      usp_ProductCategoryList.htm for Adventure Works Cycles Storefront Sample
  Summary:   Self-documentation for application
  Date:	     June 16, 2003

=====================================================================

  This file is part of the Microsoft SQL Server Code Samples.
  Copyright (C) Microsoft Corporation.  All rights reserved.

This source code is intended only as a supplement to Microsoft
Development Tools and/or on-line documentation.  See these other
materials for detailed information regarding Microsoft code samples.

THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
PARTICULAR PURPOSE.

======================================================= -->
    <head>
        <title>Adventure Works Cycles Store Documentation</title>
        <link rel="stylesheet" href="style.css">
    </head>
    <body>
        <h1>
            "usp_ProductCategoryList" Stored Procedure
        </h1>
        <b>Description:</b>
        <P>
            This is a simple stored procedure that returns a list of all the product
            categories and subcategories in the database.&nbsp; It is the engine behind the _Menu.aspx that
            builds the navigation tree control on the left hand side of the Adventure Works Cycles application.
        </P>
        <b>Definition:</b>
<pre style="background-color:white">
<span style="color: #0000FF"><strong>CREATE</strong></span> Procedure usp_ProductCategoryList

<span style="color: #0000FF"><strong>AS</strong></span>

<span style="color: #0000FF"><strong>SELECT</strong></span> 
   ProductCategoryID<span style="color: #4444FF">,</span>
   [<span style="color: #0000FF"><strong>Name</strong></span>]

<span style="color: #0000FF"><strong>FROM</strong></span> 
    Production.ProductCategory

<span style="color: #0000FF"><strong>ORDER BY</strong></span> 
    [<span style="color: #0000FF"><strong>Name</strong></span>] ASC;

<span style="color: #0000FF"><strong>SELECT</strong></span>
	ProductCategoryID<span style="color: #4444FF">,</span>
	ProductSubcategoryID<span style="color: #4444FF">,</span>
	[<span style="color: #0000FF"><strong>Name</strong></span>]
<span style="color: #0000FF"><strong>FROM</strong></span>
	Production.ProductSubcategory

<span style="color: #0000FF"><strong>ORDER BY</strong></span> 
      ProductCategoryID<span style="color: #4444FF">,</span> [<span style="color: #0000FF"><strong>Name</strong></span>] ASC;


</pre>
        <b>Database Tables Used: </b>
        <P>
            <i>ProductCategory</i> and <i>ProductSubCategory</i>:
        &nbsp;&nbsp;The ProductCategory and ProductSubCategory tables contain a list of all the groups and subgroups of products stored in
        the database.&nbsp; The content of these tables drives the tree control on the left hand side of the web
        site.&nbsp; There is a one to many relationship between the ProductSubCategory table
        and the Product Table, since every product must belong to a subcategory.
        <p>
            <img src="1x1.gif" width="25"> <IMG src="../docs/images/Category-Subcategory.gif" width="435" height="317">
        </p>
    </body>
</html>
